From 5cdff1952ec65b497374d174c7854afe0b291a7f Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 3 Dec 2010 09:36:47 +0000 Subject: [PATCH] libxc: osdep: convert xc_evtchn_fd() Signed-off-by: Ian Campbell Signed-off-by: Ian Jackson --- tools/libxc/xc_evtchn.c | 5 +++++ tools/libxc/xc_linux.c | 8 ++++++-- tools/libxc/xc_minios.c | 8 ++++++-- tools/libxc/xc_netbsd.c | 8 ++++++-- tools/libxc/xc_solaris.c | 8 ++++++-- tools/libxc/xenctrlosdep.h | 3 +++ 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index 528b59305b..899a9edae0 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -77,3 +77,8 @@ int xc_evtchn_status(xc_interface *xch, xc_evtchn_status_t *status) return do_evtchn_op(xch, EVTCHNOP_status, status, sizeof(*status), 1); } + +int xc_evtchn_fd(xc_evtchn *xce) +{ + return xce->ops->u.evtchn.fd(xce, xce->ops_handle); +} diff --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index d247c9c193..d6956ccc85 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -360,9 +360,9 @@ static int linux_evtchn_close(xc_evtchn *xce, xc_osdep_handle h) return close(fd); } -int xc_evtchn_fd(xc_evtchn *xce) +static int linux_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h) { - return xce->fd; + return (int)h; } int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port) @@ -434,6 +434,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port) static struct xc_osdep_ops linux_evtchn_ops = { .open = &linux_evtchn_open, .close = &linux_evtchn_close, + + .u.evtchn = { + .fd = &linux_evtchn_fd, + }, }; /* Optionally flush file to disk and discard page cache */ diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c index 942fa7b262..aeda6eab09 100644 --- a/tools/libxc/xc_minios.c +++ b/tools/libxc/xc_minios.c @@ -226,9 +226,9 @@ void minios_evtchn_close_fd(int fd) files[fd].type = FTYPE_NONE; } -int xc_evtchn_fd(xc_evtchn *xce) +static int minios_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h) { - return xce->fd; + return (int)h; } int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port) @@ -400,6 +400,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port) static struct xc_osdep_ops minios_evtchn_ops = { .open = &minios_evtchn_open, .close = &minios_evtchn_close, + + .u.evtchn = { + .fd = &minios_evtchn_fd, + }, }; /* Optionally flush file to disk and discard page cache */ diff --git a/tools/libxc/xc_netbsd.c b/tools/libxc/xc_netbsd.c index 7c60104e4f..2f632fbdb7 100644 --- a/tools/libxc/xc_netbsd.c +++ b/tools/libxc/xc_netbsd.c @@ -210,9 +210,9 @@ static int netbsd_evtchn_close(xc_evtchn *xce, xc_osdep_handle h) return close(fd); } -int xc_evtchn_fd(xc_evtchn *xce) +static int netbsd_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h) { - return xce->fd; + return (int)h; } int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port) @@ -299,6 +299,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port) static struct xc_osdep_ops netbsd_evtchn_ops = { .open = &netbsd_evtchn_open, .close = &netbsd_evtchn_close, + + .u.evtchn = { + .fd = &netbsd_evtchn_fd, + }, }; /* Optionally flush file to disk and discard page cache */ diff --git a/tools/libxc/xc_solaris.c b/tools/libxc/xc_solaris.c index 3867e8960a..506319b7ff 100644 --- a/tools/libxc/xc_solaris.c +++ b/tools/libxc/xc_solaris.c @@ -202,9 +202,9 @@ static int solaris_evtchn_close(xc_evtchn *xce, xc_osdep_handle h) return close(fd); } -int xc_evtchn_fd(xc_evtchn *xce) +static int solaris_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h) { - return xce->fd; + return (int)h; } int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port) @@ -276,6 +276,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port) static struct xc_osdep_ops solaris_evtchn_ops = { .open = &solaris_evtchn_open, .close = &solaris_evtchn_close, + + .u.evtchn = { + .fd = &solaris_evtchn_fd, + }, }; /* Optionally flush file to disk and discard page cache */ diff --git a/tools/libxc/xenctrlosdep.h b/tools/libxc/xenctrlosdep.h index 5f93b7361d..8607ad8f80 100644 --- a/tools/libxc/xenctrlosdep.h +++ b/tools/libxc/xenctrlosdep.h @@ -74,6 +74,9 @@ struct xc_osdep_ops size_t chunksize, privcmd_mmap_entry_t entries[], int nentries); } privcmd; + struct { + int (*fd)(xc_evtchn *xce, xc_osdep_handle h); + } evtchn; } u; }; typedef struct xc_osdep_ops xc_osdep_ops; -- 2.30.2